import java.util.*;
import java.lang.*;

public class CaeserCipher {//凯撒密码

    public static void main(String[] args) {
        System.out.println("输入一串字符串作为明文（回车结束）：");
        Scanner input = new Scanner(System.in);
        String m = input.next();//读入一行字符串，以回车为标志
        System.out.println("输入密钥：");
        int k = input.nextInt();
        int key = k % 26;//防止密钥超界
        Arithmetic output = new Arithmetic();
        String c = output.encrpty(m, k);
        System.out.println("加密后的密文为：" + c);
        System.out.println("解密后的明文为：" + output.decrypt(c, key));
    }
}
